package com.feeyo.prophet.config;

import com.feeyo.prophet.exception.ApiException;
import com.feeyo.prophet.pojo.vo.ResultVO;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(ApiException.class)
    public <T> ResultVO<T> handleApiException(ApiException ex) {
        return ResultVO.sendError(ex.getResultEnum());
    }
}
